import axios from 'axios'
// import qs from 'qs'

// 实例对象
const instance = axios.create({
  baseURL: 'http://localhost:3007',
  timeout: 1000,
  headers: {
    'Content-Type': false
  }
})

// 请求拦截器
instance.interceptors.request.use(
  config => {
    const token = localStorage.getItem('Authorization')
    if(token && token !== '') {
      config.headers['Authorization'] = token
    }
    return config
    //config.data = qs.stringify(config.data) // 转为formdata数据格式
    //return config
  },
  error => Promise.error(error)
)

export default instance
